package com.ly.heart.service.impl;

import java.util.List;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import org.springframework.stereotype.Service;
import com.ly.heart.mapper.ProjectDynamicsMapper;
import com.ly.heart.domain.ProjectDynamicsEntity;
import com.ly.heart.service.IProjectDynamicsService;

import javax.annotation.Resource;

/**
 * 项目动态Service业务层处理
 *
 * @author cxl
 * @date 2024-05-14
 */
@Service
public class ProjectDynamicsServiceImpl implements IProjectDynamicsService {

    @Resource
    private ProjectDynamicsMapper projectDynamicsMapper;

    /**
     * 查询项目动态
     *
     * @param id 项目动态主键
     * @return 项目动态
     */
    @Override
    public ProjectDynamicsEntity selectProjectDynamicsEntityById ( String id ) {
        return projectDynamicsMapper.selectProjectDynamicsEntityById ( id );
    }

    /**
     * 查询项目动态列表
     *
     * @param projectDynamicsEntity 项目动态
     * @return 项目动态
     */
    @Override
    public List<ProjectDynamicsEntity> selectProjectDynamicsEntityList ( ProjectDynamicsEntity projectDynamicsEntity ) {
        return projectDynamicsMapper.selectProjectDynamicsEntityList ( projectDynamicsEntity );
    }

    /**
     * 新增项目动态
     *
     * @param projectDynamicsEntity 项目动态
     * @return 结果
     */
    @Override
    public int insertProjectDynamicsEntity ( ProjectDynamicsEntity projectDynamicsEntity ) {
        projectDynamicsEntity.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        projectDynamicsEntity.setCreateTime ( DateUtils.getNowDate () );
        return projectDynamicsMapper.insertProjectDynamicsEntity ( projectDynamicsEntity );
    }

    /**
     * 修改项目动态
     *
     * @param projectDynamicsEntity 项目动态
     * @return 结果
     */
    @Override
    public int updateProjectDynamicsEntity ( ProjectDynamicsEntity projectDynamicsEntity ) {
        projectDynamicsEntity.setChangeTime ( DateUtils.getNowDate () );
        return projectDynamicsMapper.updateProjectDynamicsEntity ( projectDynamicsEntity );
    }

    /**
     * 批量删除项目动态
     *
     * @param ids 需要删除的项目动态主键
     * @return 结果
     */
    @Override
    public int deleteProjectDynamicsEntityByIds ( String[] ids ) {
        return projectDynamicsMapper.deleteProjectDynamicsEntityByIds ( ids );
    }

    /**
     * 删除项目动态信息
     *
     * @param id 项目动态主键
     * @return 结果
     */
    @Override
    public int deleteProjectDynamicsEntityById ( String id ) {
        return projectDynamicsMapper.deleteProjectDynamicsEntityById ( id );
    }
}
